package com.org.xdq.Sum;

public class One extends Thread{
    private Integer s = 0;
    @Override
    public void run() {
        super.run();
    }





    public One(Integer[] n,Integer[] u,Integer[] m) {

        Thread b = new Two(u){
            @Override
            public void run() {
                for(int i=0;i<u.length;i++){
                    s=s+u[i];
                }
            }
        };
        b.start();
        Thread c = new Three(m){
            @Override
            public void run() {
                for(int i =0;i<m.length;i++){
                    s=s+m[i];
                }
            }
        };
        c.start();
        for(int i= 0;i<n.length;i++){
            try {
                b.join();
                c.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            s=s+n[i];
        }
        System.out.println(s);
    }
}
